package com.tj.bigdata.syncblock.service;

import com.tj.bigdata.syncblock.entity.BlockInfo;
import com.tj.bigdata.syncblock.entity.Transactions;
import org.web3j.protocol.core.methods.response.EthBlock;

import java.io.IOException;
import java.math.BigInteger;
import java.util.List;

/**
 * Es同步区块和交易信息接口
 */
public interface EsUpService {

    /**
     * 上传区块信息
     *
     * @param block 区块
     * @return 是否上传ES成功
     * @throws IOException 异常
     */
    Boolean blockInfoUp(BlockInfo block) throws IOException;

    Boolean blockInfoUp(EthBlock.Block  block) throws IOException;

    /**
     * 上传交易
     *
     * @param transactions 交易
     * @return 是否上传ES成功
     * @throws IOException 异常
     */
    Boolean transactionInfoUp(List<Transactions> transactions) throws IOException;

    /**
     *  固定ES索引
     * @param transactions 交易
     * @return 成功
     * @throws IOException 异常
     */
    Boolean transactionInfoStreamSourceUp(List<Transactions> transactions) throws IOException;

    Boolean transactionInfoUp(Transactions transaction) throws IOException;

    /**
     * 获取当前最大同步区块number
     * @return
     */
    BigInteger maxBlockBumber();
}
